package org.lpw.wormhole.queue;

import org.lpw.wormhole.element.Element;
import org.lpw.wormhole.util.Kit;

/**
 * @author lpw
 */
public class QueueImpl
    implements Queue
{
    protected final Kit kit;
    protected final LocalQueue localQueue;
    protected final RemoteQueue remoteQueue;

    public QueueImpl(Kit kit, LocalQueue localQueue, RemoteQueue remoteQueue)
    {
        this.kit = kit;
        this.localQueue = localQueue;
        this.remoteQueue = remoteQueue;
    }

    @Override
    public void push(String key, Object value)
    {
        if(key==null||value==null)
            return;

        Element element = new Element();
        element.setKey(key);
        element.setValue(value);

        localQueue.push(element);
        remoteQueue.push(element);
    }
}
